/*
	SnowstormXGame.h

	Header for SnowstormX game code functionality.
	Note that calling any of the functions defined here outside of the game code context
	is not supported, and may result in undefined behaviour or engine crashes.

	Author: Aidan Goddard 1/8/14
*/

#ifndef SNOWSTORMXGAME_H_INCLUDED
#define SNOWSTORMXGAME_H_INCLUDED

#include"SnowstormXExports.h"
#include<cstdint>
#include"SnowstormXEngineVars.h"
#include"SnowstormXEntity.h"



//////////////////////////////////////////////////
// Engine functions

// causes the engine to terminate
SNOWSTORMXDLL_API void XKill(uint64_t exit_code);

// pauses all game code (entity actions, events, etc) except the GameMain function
SNOWSTORMXDLL_API void XPauseAll();

// pauses only the map entities
SNOWSTORMXDLL_API void XPauseMapEntities();

// resumes all game code
SNOWSTORMXDLL_API void XResume();

// tells the engine to reset the rendering system. use this to make it acknowledge changed settings
//SNOWSTORMXDLL_API void XRenderEngineReset();

//////////////////////////////////////////////////
// Map Loading/Control functions

// start loading a map
//SNOWSTORMXDLL_API void XMapLoad(uint32_t map, wchar_t *map_file);

// get status of a map
//#define MAP_LOAD_STATUS_NOT_LOADING 0xffffffff;
//SNOWSTORMXDLL_API uint32_t XMapStatus(uint32_t map);

// tells the engine to switch the current active map. returns false if the other map is not ready
//SNOWSTORMXDLL_API bool XMapSwap(uint32_t map);

//////////////////////////////////////////////////
// User Input functions & events

SNOWSTORMXDLL_API void XRegisterKeyPressedEvent(EVENT event, uint8_t virtual_key);
SNOWSTORMXDLL_API void XRegisterKeyHeldEvent(EVENT event, uint8_t virtual_key);
SNOWSTORMXDLL_API void XRegisterKeyReleasedEvent(EVENT event, uint8_t virtual_key);
SNOWSTORMXDLL_API void XRegisterCloseClickEvent(EVENT event);

//////////////////////////////////////////////////
// Scheduling functions
#define XWait(wait_time) this->Wait((wait_time))

//////////////////////////////////////////////////
// Debugging/testing related

// engine-safe function to print a string to the standard output buffer
SNOWSTORMXDLL_API void PrintString(uint32_t SNOWSTORM_ENGINE_TID, wchar_t *string);
#define XPrintString(string) PrintString(SNOWSTORM_ENGINE_TID, string)

//////////////////////////////////////////////////
// Entity control functions
SNOWSTORMXDLL_API void CreatePersistentEntity(uint32_t SNOWSTORM_ENGINE_TID, Snowstorm::Entity *entity);
#define XCreatePersistentEntity(entity) CreatePersistentEntity(SNOWSTORM_ENGINE_TID, (entity))
SNOWSTORMXDLL_API void DeletePersistentEntity(uint32_t SNOWSTORM_ENGINE_TID, Snowstorm::Entity *entity);
#define XRemovePersistentEntity(entity) DeletePersistentEntity(SNOWSTORM_ENGINE_TID, (entity))

//////////////////////////////////////////////////
// 2D graphics functions

SNOWSTORMXDLL_API void XSetBackgroundColour(float r, float g, float b);


#endif